const RedwoodDRM = {
    /*
     * Extracted directly from YouTube's player, no regrets lol.
     */
    drmHandlerVersion: "18-06-2021",
    decipherServerCertificate: function(str) {
        var g = {};
        var a = { FF: "" };
        g.A = this || self;
        var navigator = { userAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36" };
        g.A["navigator"] = navigator;
		var Yd = {}, ee = null;
        a: {
          var pJa = g.A.navigator;
          if (pJa) {
            var qJa = pJa.userAgent;
            if (qJa) {
              g.Tc = qJa;
              break a;
            }
          }
          g.Tc = "";
        }
        Uc = function (a) {
          return -1 != g.Tc.indexOf(a);
        };
        zc = function(a, b) {
            return -1 != a.toLowerCase().indexOf(b.toLowerCase())
        };
        var Dl = (Dl =
          Uc("Gecko") &&
          !(zc(g.Tc, "WebKit") && !Uc("Edge")) &&
          !(Uc("Trident") || Uc("MSIE")) &&
          !Uc("Edge"));
        a: {
          var X1 = "",
            Y1 = (function () {
              var a = g.Tc;
              if (Dl) return /rv:([^\);]+)(\)|;)/.exec(a);
              if (g.tw) return /Edge\/([\d\.]+)/.exec(a);
              if (g.de) return /\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(a);
              if (g.hg) return /WebKit\/(\S+)/.exec(a);
              if (g.Wk) return /(?:Version)[ \/]?(\S+)/.exec(a);
            })();
          Y1 && (X1 = Y1 ? Y1[1] : "");
          if (g.de) {
            var Z1 = Td();
            if (null != Z1 && Z1 > parseFloat(X1)) {
              W1 = String(Z1);
              break a;
            }
          }
          W1 = X1;
        }
        var Ud = W1,
          Maa = {},
          $1;
        if (g.A.document && g.de) {
          var yJa = Td();
          $1 = yJa ? yJa : parseInt(Ud, 10) || void 0;
        } else $1 = void 0;
        var Naa = $1;
        g.Wd = function (a) {
          return Number(Naa) >= a;
        };
        vF = function (a) {
          return g.wd(a);
        };
        g.rc = function (a) {
          return /^[\s\xa0]*$/.test(a);
        };
        $d = function (a, b) {
          function c(m) {
            for (; d < a.length; ) {
              var n = a.charAt(d++),
                p = ee[n];
              if (null != p) return p;
              if (!g.rc(n))
                throw Error("Unknown base64 encoding at char: " + n);
            }
            return m;
          }
          Xd();
          for (var d = 0; ; ) {
            var e = c(-1),
              f = c(0),
              h = c(64),
              l = c(64);
            if (64 === l && -1 === e) break;
            b((e << 2) | (f >> 4));
            64 != h &&
              (b(((f << 4) & 240) | (h >> 2)),
              64 != l && b(((h << 6) & 192) | l));
          }
        };
        Xd = function () {
          if (!ee) {
            ee = {};
            for (
              var a =
                  "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(
                    ""
                  ),
                b = ["+/=", "+/", "-_=", "-_.", "-_"],
                c = 0;
              5 > c;
              c++
            ) {
              var d = a.concat(b[c].split(""));
              Yd[c] = d;
              for (var e = 0; e < d.length; e++) {
                var f = d[e];
                void 0 === ee[f] && (ee[f] = e);
              }
            }
          }
        };
        g.wd = function (a) {
          !g.de || g.Vd("10");
          var b = a.length,
            c = (3 * b) / 4;
          c % 3
            ? (c = Math.floor(c))
            : -1 != "=.".indexOf(a[b - 1]) &&
              (c = -1 != "=.".indexOf(a[b - 2]) ? c - 2 : c - 1);
          var d = new Uint8Array(c),
            e = 0;
          $d(a, function (f) {
            d[e++] = f;
          });
          return d.subarray(0, e);
        };
        return vF(str);
    }
}
